<template>
	<view class="all">
		<view class="pic">
			<u-swiper radius='0' :list="list1" @change="e => current = e.current" height="281">
				<view slot="indicator" class="indicator">
					<view class="indicator__dot" v-for="(item, index) in list1" :key="index"
						:class="[index === current && 'indicator__dot--active']">
					</view>
				</view>
			</u-swiper>
			<view style="height: var(--status-bar-height);opacity: 0;">
				<!-- app状态栏高度占位 -->
			</view>
			<view class="return iconfont" @click="toHome()">
				&#xe601;
			</view>
		</view>
		<view class="roomStyle">
			<view class="title">
				{{dataList.home_type}}
			</view>
			<view class="line_2">
				<view class="left">
					<view class="">
						面积：{{dataList.home_size}}㎡
					</view>
					<view class="" style="margin-left: 45rpx;">
						房间数：{{roomNum}}
					</view>
				</view>
				<view class="right">
					￥{{dataList.home_price}}/月
				</view>	
			</view>
			<view class="describe">
				{{dataList.home_detail}}
			</view>
		</view>
		<view class="roomFacility">
			<view class="title">
				房间设施
			</view>
			<view class="line_2">
				{{dataList.home_facility}}
			</view>
		</view>
		<view class="tips">
			<view class="title">
				温馨提示
			</view>
			<view class="content">
				1.养老机构按照老人自愿入院的原则入住。<br>
				2.养老机构可能对老人提供流动服务与呼叫服务相结合。老人及子女若有增项服务，应该与院方协商，取得同意方可使用。<br>
				3.预约成功后，养老机构会收到您的预约信息，请等待工作人员与您联系。<br>
				4.预约成功后，欢迎您按预约时间前往养老院机构参观环境和现场查看房型。
			</view>
		</view>
	</view>
</template>

<script>
	import {homeTypeInfo} from '@/utils/api.js'
	export default {
		data() {
			return {
				current: 0,
				list1: [],
				dataList:{},
				roomNum:0,
				roomTypeID:''
			};
		},
		onLoad(option) {
			console.log(option,'888');
			this.roomTypeID=option
			homeTypeInfo(option).then((res)=>{
				if(res.data.meta.status==200){
					this.dataList=res.data.data
					this.list1=res.data.data.home_img
					this.roomNum=res.data.data.home_num.length
					console.log(this.list1,'*********');
				}
			})
		},
		methods: {
			toHome(){
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.all {
		position: relative;
		
		.indicator {
			@include flex(row);
			justify-content: center;

			&__dot {
				height: 6px;
				width: 6px;
				border-radius: 100px;
				background-color: rgba(255, 255, 255, 0.35);
				margin: 0 5px;
				transition: background-color 0.3s;

				&--active {
					background-color: #ffffff;
				}
			}
		}

		.indicator-num {
			padding: 2px 0;
			background-color: rgba(0, 0, 0, 0.35);
			border-radius: 100px;
			width: 35px;
			@include flex;
			justify-content: center;

			&__text {
				color: #FFFFFF;
				font-size: 12px;
			}
		}

		.pic {

			width: 100%;
			height: 281px;

			.return {
				position: fixed;
				height: 30rpx;
				top: var(--status-bar-height);
				left: 30rpx;
				right: 0;
				bottom: 0;
				color: #ffffff;
				font-size: 24px;

			}
		}
		.roomStyle{
			background-color: #FFFFFF;
			padding: 40rpx 24rpx;
			.title{
				font-size: 36rpx;
				font-weight: bold;
				color: #242424;
			}
			.line_2{
				margin-top: 20rpx;
				display: flex;
				justify-content: space-between;
				.left{
					font-size: 26rpx;
					font-weight: bold;
					color: #686868;
					display: flex;
				}
				.right{
					font-size: 36rpx;
					font-weight: bold;
					color: #E82828;
				}
			}
			.describe{
				font-size: 26rpx;
				font-weight: bold;
				color: #484848;
				line-height: 40rpx;
			}
		}
		.roomFacility{
			margin-top: 20rpx;
			background-color: #FFFFFF;
			padding: 40rpx 24rpx;
			.title{
				font-size: 36rpx;
				font-weight: bold;
				color: #242424;
			}
			.line_2{
				margin-top: 40rpx;
				font-size: 26rpx;
				font-weight: bold;
				color: #686868;
				
			}
		}
		.tips{
			border-bottom:2rpx solid #f1f7fe;
			background-color: #FFFFFF;
			padding: 40rpx 24rpx;
			.title{
				font-size: 36rpx;
				font-weight: bold;
				color: #242424;
			}
			.content{
				margin-top: 30rpx;
				font-size: 26rpx;
				font-weight: bold;
				color: #686868;
				line-height: 40rpx;
				
			}
		}
		.btns{
			height: 200rpx;
			background: #FFFFFF;
			display: flex;
			justify-content: center;
			align-items: center;
			.btn{
				width: 462rpx;
				height: 88rpx;
				background: #5398F6;
				border-radius: 44rpx;
				text-align: center;
				line-height:88rpx ;
				font-size: 32rpx;
				font-weight: bold;
				color: #FFFFFF;
			}
		}
	}
</style>